home *** CD-ROM | disk | FTP | other *** search
/ CD School House 9 / CD School House 9.0 - Wayzata Technology (1994).iso / pc / games / mac / __adventureland__ / __adventure_helpers__ / dungeon_mastery_2_0 / dm_reference / stack.txt < prev   
Text File  |  1992-05-24  |  17KB  |  559 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 4
  11. -- first background id: 7320
  12. -- card count: 16
  13. -- first card id: 5967
  14. -- list block id: 2111
  15. -- print block id: 3470
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 121280 bytes
  21. -- stack block size: 15872 bytes
  22. -- created by hypercard version: 0x01258000
  23. -- compacted by hypercard version: 0x01258000
  24. -- modified by hypercard version: 0x01258000
  25. -- opened by hypercard version: 0x01258000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x0000220000002200
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0xCC003300CC003300
  30. -- patterns[4]: 0xCC883322CC883322
  31. -- patterns[5]: 0xEE88BB22EE88BB22
  32. -- patterns[6]: 0xEECCBB33EECCBB33
  33. -- patterns[7]: 0xFFCCFF33FFCCFF33
  34. -- patterns[8]: 0xFFEEFFBBFFEEFFBB
  35. -- patterns[9]: 0xFFFFFFBBFFFFFFBB
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x1028458204380000
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x0100000010000000
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöNavigational HandlersΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇö
  69. on openstack
  70.   global DMmenu,MnstrMenu,MagicMenu,EquipMenu
  71.   put NewMenu("DM","Help...","Preferences...","(-","Dice...", "Sort Cards","Show Cards","(-","Notebook") into DMmenu
  72.   put cd fld "Monster Index" of cd 1 of bg "bMnstr" into MnstrMenu
  73.   put cd fld "Magic Index" of cd 1 of bg "cwiz" into MagicMenu
  74.   put cd fld "Equip Index" of cd 1 of bg "eItem" into EquipMenu
  75. end openstack
  76.  
  77. on closeStack
  78.   global DMmenu
  79.   if the freeSize of this stack>15000 then
  80.     sulvl
  81.     doMenu "compact stack"
  82.     rulvl
  83.   end if
  84.   get deleteMenu(DMmenu)
  85. end closeStack
  86.  
  87. on doMenu which        --  get our menu items before HyperCard does
  88.   if which is      "Help..."        then
  89.     send mouseup to bg btn "help"
  90.   else if which is "Preferences..." then pref
  91.   else if which is "Dice..." then
  92.     ask "Specify dice to roll..." with "d20"
  93.     answer "The result is"&&rolldice(it)&"." with "OK"
  94.   else if which is "Sort Cards" then sortem
  95.   else if which is "Show Cards" then showcd
  96.   else if which is "Notebook"   then gonotes
  97.   else if which is "-"          then exit doMenu
  98.   else pass doMenu  --  Remember to pass untrapped menu commands!
  99. end doMenu
  100.  
  101. on closebackground
  102.   global bmnstr,cwiz
  103.   do "put the long name of this card into"&&the short name of this background
  104. end closebackground
  105.  
  106. on gonext
  107.   get id of last card of this background
  108.   visual wipe left
  109.   if id of this card is it then go to card 1 of this background
  110.   else go to next card
  111. end gonext
  112.  
  113. on goprev
  114.   get id of card 1 of this background
  115.   visual wipe right
  116.   if id of this card is it then go to last card of this background
  117.   else go to previous card
  118. end goprev
  119.  
  120. on godm
  121.   visual scroll up
  122.   go to card 1 of "Dungeon Mastery"
  123. end godm
  124.  
  125. on goadv
  126.   global adv
  127.   visual scroll up
  128.   if adv is empty then go "the adventure to open"
  129.   else go adv
  130. end goadv
  131.  
  132. on goenc
  133.   global enc
  134.   visual scroll up
  135.   if enc is empty then go to card 1 of background "Enc" of "Dungeon Mastery"
  136.   else go enc
  137. end goenc
  138.  
  139. on goexp
  140.   global exp
  141.   visual scroll up
  142.   if exp is empty then go to card 1 of background "Exp" of "Dungeon Mastery"
  143.   else go exp
  144. end goexp
  145.  
  146. on gocom
  147.   global com
  148.   visual scroll up
  149.   if com is empty then go to card 1 of background "Com" of "Dungeon Mastery"
  150.   else go com
  151. end gocom
  152.  
  153. on gonotes
  154.   global notes
  155.   visual scroll up
  156.   if notes is empty then go to card 1 of background "Notes" of "Dungeon Mastery"
  157.   else go notes
  158. end gonotes
  159.  
  160. on goutil
  161.   visual scroll up
  162.   go to card "Utilities" of "Dungeon Mastery"
  163. end goutil
  164.  
  165. on gohero
  166.   visual scroll up
  167.   go to card 1 of background "ahero" of "DM Reference"
  168. end gohero
  169.  
  170. on gomnstr
  171.   global bmnstr
  172.   visual scroll up
  173.   chkbg
  174.   if bmnstr is empty then go to card 1 of background "bmnstr" of "DM Reference"
  175.   else go bmnstr
  176. end gomnstr
  177.  
  178. on gowiz
  179.   global cwiz
  180.   visual dissolve
  181.   chkbg
  182.   if cwiz is empty then go to card 1 of background "cwiz" of "DM Reference"
  183.   else go cwiz
  184. end gowiz
  185.  
  186. on goitm
  187.   visual scroll up
  188.   go to card 1 of background "eitem" of "DM Reference"
  189. end goitm
  190.  
  191. on gocal
  192.   lock screen
  193.   go to card 1 of background "cal" of "Dungeon Mastery"
  194.   if line 2 of field id 76 is not empty then go to line 2 of field id 76
  195.   unlock screen with visual scroll up
  196. end gocal
  197.  
  198. on chkbg
  199.   if the short name of the target is the short name of this background then
  200.     go to card 1 of this background
  201.     exit to hypercard
  202.   end if
  203. end chkbg
  204.  
  205. ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöPreferences HandlersΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇö
  206. on pref
  207.   global hldcd
  208.   push card
  209.   pop card into hldcd
  210.   lock screen
  211.   go to card 1 of this background
  212.   if the short name of this bg is "ahero" then
  213.     repeat with i=18 to 24
  214.       show button id i
  215.     end repeat
  216.     show button "OK"
  217.     show card field "backdrop"
  218.     show card field "descript"
  219.   else
  220.     show cd field "Preferences"
  221.     show cd button "OK"
  222.     if the short name of this bg is "bmnstr" then put "monster" into nm
  223.     else if the short name of this bg is "cwiz" then put "magic" into nm
  224.     else if the short name of this bg is "eitem" then put "equip" into nm
  225.     set the locktext of cd field (nm&&"Index") to false
  226.     set the Style of cd field (nm&&"Index") to rectangle
  227.     set the showlines of cd field (nm&&"Index") to true
  228.     show cd field (nm&&"Index")
  229.   end if
  230.   unlock screen with visual zoom open
  231. end pref
  232.  
  233. ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöSort Cards HandlersΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇö
  234. on sortem
  235.   lockem true
  236.   set cursor to busy
  237.   put the id of this cd into rtncd
  238.   put the number of this background into bgnum
  239.   sort by backgroundSort(bgnum)
  240.   go to rtncd
  241. end sortem
  242.  
  243. function backgroundSort bgnum
  244. set cursor to busy
  245. if the number of this bg <> bgnum then
  246.   return the short name of this background
  247. else
  248.   do "put (the short name of this bg)&(bg field Cat"&bgnum& ")&(bg field Name"&bgnum&") into bgsrt"
  249.   return bgsrt
  250. end if
  251. end backgroundSort
  252.  
  253. ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöShow Cards HandlersΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇö
  254. on showcd
  255.   put number of this card into thiscd
  256.   lock screen
  257.   go to last card of this background
  258.   put number of this card into lastcd
  259.   go to card thiscd
  260.   unlock screen
  261.   show (lastcd-thiscd) cards
  262. end showcd
  263.  
  264. ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöHelp HandlersΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇö
  265. on gohelp winname
  266.   lock screen
  267.   push card
  268.   go to first card of this background
  269.   hide card picture
  270.   hide card button "obscure 1"
  271.   show card button winname
  272.   show card button "Close box"
  273.   if the short name of this background is "aHero" then
  274.     set the scroll of field "descript" to 0
  275.     set the locktext of field "descript" to true
  276.     hide card field "Party"
  277.   else if the short name of this background is "bMnstr" then
  278.     set the scroll of field "descript" to 0
  279.     set the locktext of field "descript" to true
  280.     if the visible of cd btn "OK" is false then
  281.       hide card field "Monster Index"
  282.     end if
  283.   else if the short name of this background is "cWiz" then
  284.     show card field "Magic Help"
  285.     if the visible of cd btn "OK" is false then
  286.       hide card field "Magic Index"
  287.     end if
  288.   else if the short name of this background is "eItem" then
  289.     show card field "Equipment Help"
  290.     if the visible of cd btn "OK" is false then
  291.       hide card field "Equip Index"
  292.     end if
  293.   end if
  294.   unlock screen with visual zoom open
  295. end gohelp
  296.  
  297. on closehelp winname
  298.   lock screen
  299.   show card picture
  300.   show card button "obscure 1"
  301.   hide card button winname
  302.   hide card button "Close box"
  303.   if the short name of this background is "aHero" then
  304.     set the locktext of field "descript" to false
  305.     show card field "Party"
  306.   else if the short name of this background is "bMnstr" then
  307.     set the locktext of field "descript" to false
  308.     show card field "Monster Index"
  309.   else if the short name of this background is "cWiz" then
  310.     hide card field "Magic Help"
  311.     show card field "Magic Index"
  312.   else if the short name of this background is "eItem" then
  313.     hide card field "Equipment Help"
  314.     show card field "Equip Index"
  315.   end if
  316.   pop card
  317.   unlock screen with visual zoom close
  318. end closehelp
  319.  
  320. ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöUtility HandlersΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇö
  321. on lockem which
  322.   set lockscreen to which
  323.   set lockmessages to which
  324.   set lockrecent to which
  325. end lockem
  326.  
  327. on sulvl
  328.   global ulsv
  329.   put the userlevel into ulsv
  330.   if ulsv < 4 then set the userLevel to 4
  331. end sulvl
  332.  
  333. on rulvl
  334.   global ulsv
  335.   set the userLevel to ulsv
  336. end rulvl
  337.  
  338. function clkln
  339. return ((item 2 of the clickloc - item 2 of the rect of the target) div the textheight of the target) + 1
  340. end clkln
  341.  
  342. on nick nm
  343.   global nknm
  344.   put nm into field "nickname"
  345.   if chknm() is false then
  346.     set the name of this card to nm
  347.     put "true" into nknm
  348.     exit nick
  349.   end if
  350. end nick
  351.  
  352. function chknm
  353. put true into chk
  354. put field "nickname" into nm
  355. put the id of this card into nmid
  356. push card
  357. go to card nm
  358. if the id of this card is nmid then put false into chk
  359. pop card
  360. return chk
  361. end chknm
  362.  
  363. function rolldice type
  364. put interp(type) into cmdb
  365. put empty into roll
  366. repeat with i=1 to item 1 of cmdb
  367.   repeat with j=1 to item 2 of cmdb
  368.     add random(item 3 of cmdb) to roll
  369.   end repeat
  370.   add item 4 of cmdb to roll
  371. end repeat
  372. return roll
  373. end rolldice
  374.  
  375. function interp type
  376. put ",,," into cmdb
  377. if "x" is in type then put 1 into itm
  378. else put 2 into itm
  379. repeat with i=1 to length of type
  380.   put character i of type into chr
  381.   if chr is "x" then put 2 into itm
  382.   else if chr is "d" then put 3 into itm
  383.   else if chr is "+" or chr is "-" then
  384.     if chrΓëá"+" then put chr into item 4 of cmdb
  385.     put 4 into itm
  386.   else put chr after item itm of cmdb
  387. end repeat
  388. if item 1 of cmdb is empty then put 1 into item 1 of cmdb
  389. if item 2 of cmdb is empty then put 1 into item 2 of cmdb
  390. if item 3 of cmdb is empty then put 1 into item 3 of cmdb
  391. if item 4 of cmdb is empty then put 0 into item 4 of cmdb
  392. return cmdb
  393. end interp
  394.  
  395. on svthrw clvr
  396.   put item 1 of clvr into cls
  397.   put item 2 of clvr into lv
  398.   put item 3 of clvr into rc
  399.   if lv=0 then savtab "16,18,17,20,19"
  400.   else
  401.     if cls is "Warrior" then
  402.       if      lv>16 then savtab "3,5,4,4,6"
  403.       else if lv>14 then savtab "4,6,5,4,7"
  404.       else if lv>12 then savtab "5,7,6,5,8"
  405.       else if lv>10 then savtab "7,9,8,8,10"
  406.       else if lv> 8 then savtab "8,10,9,9,11"
  407.       else if lv> 6 then savtab "10,12,11,12,13"
  408.       else if lv> 4 then savtab "11,13,12,13,14"
  409.       else if lv> 2 then savtab "13,15,14,16,16"
  410.       else               savtab "14,16,15,17,17"
  411.     else if cls is "Priest" then
  412.       if      lv>18 then savtab "2,6,5,8,7"
  413.       else if lv>15 then savtab "4,8,7,10,9"
  414.       else if lv>12 then savtab "5,9,8,11,10"
  415.       else if lv> 9 then savtab "6,10,9,12,11"
  416.       else if lv> 6 then savtab "7,11,10,13,12"
  417.       else if lv> 3 then savtab "9,13,12,15,14"
  418.       else               savtab "10,14,13,16,15"
  419.     else if cls is "Rogue" then
  420.       if      lv>20 then savtab "8,4,7,11,5"
  421.       else if lv>16 then savtab "9,6,8,12,7"
  422.       else if lv>12 then savtab "10,8,9,13,9"
  423.       else if lv> 8 then savtab "11,10,10,14,11"
  424.       else if lv> 4 then savtab "12,12,11,15,13"
  425.       else               savtab "13,14,12,16,15"
  426.     else if cls is "Wizard" then
  427.       if      lv>20 then savtab "8,3,5,7,4"
  428.       else if lv>15 then savtab "10,5,7,9,6"
  429.       else if lv>10 then savtab "11,7,9,11,8"
  430.       else if lv> 5 then savtab "13,9,11,13,10"
  431.       else               savtab "14,11,13,15,12"
  432.     end if
  433.   end if
  434.   if rc is "Dwarf" or rc is "Halfling" or rc is "Gnome" then
  435.     put trunc(2*(line 2 of field "Abilities")/7) into svadj
  436.     subtract svadj from field "Staff/Wand"
  437.     subtract svadj from field "Spells"
  438.     if rc is not "Gnome" then subtract svadj from field "Poison Sv"
  439.   end if
  440.   if the short name of this background is "aHero" then
  441.     if "paladin" is in line 1 of field "Char Info" then
  442.       subtract 2 from field "Paralyze"
  443.       subtract 2 from field "Poison Sv"
  444.       subtract 2 from field "Staff/Wand"
  445.       subtract 2 from field "Petrify/Polymorph"
  446.       subtract 2 from field "Breath Weapon"
  447.       subtract 2 from field "Spells"
  448.     end if
  449.   end if
  450. end svthrw
  451.  
  452. on savtab val
  453.   put item 1 of val into field "Paralyze"
  454.   if the short name of this background is "aHero" then put item 1 of val into field "Poison Sv"
  455.   put item 2 of val into field "Staff/Wand"
  456.   put item 3 of val into field "Petrify/Polymorph"
  457.   put item 4 of val into field "Breath Weapon"
  458.   put item 5 of val into field "Spells"
  459. end savtab
  460.  
  461. on wpndmg i
  462.   put line i of field "weapon" into wpn
  463.   if line i of field "weapon damage" is empty then
  464.     put empty into wadj
  465.     --general weapons
  466.     if "sword" is in wpn or "axe" is in wpn or "bow" is in wpn then
  467.       put "1d8" into wadj
  468.     else if "mace" is in wpn or "flail" is in wpn then
  469.       put "1d6+1" into wadj
  470.     else if "hammer" is in wpn or "sling" is in wpn then
  471.       put "1d4+1" into wadj
  472.     else if "staff" is in wpn or "club" is in wpn then
  473.       put "1d6" into wadj
  474.     else if "dagger" is in wpn then
  475.       put "1d4" into wadj
  476.     else if "dart" is in wpn or "knife" is in wpn then
  477.       put "1d3" into wadj
  478.     end if
  479.     --specific weapons
  480.     if wpn is "2-hand sword" then
  481.       put "1d10" into wadj
  482.     else if wpn is "broad sword" or wpn is "morning star" or wpn is "khopesh" then
  483.       put "2d4" into wadj
  484.     else if wpn is "scimitar" then
  485.       put "1d8" into wadj
  486.     else if wpn is "trident" then
  487.       put "1d6+1" into wadj
  488.     else if wpn is "short sword" or wpn is "spear" then
  489.       put "1d6" into wadj
  490.     else if wpn is "sickle" then
  491.       put "1d4+1" into wadj
  492.     else if wpn is "hand axe" or wpn is "throwing axe" or wpn is "dirk" or wpn is "scourge" then
  493.       put "1d4" into wadj
  494.     end if
  495.     if wadj is not empty then
  496.       if the short name of this background is "aHero" then
  497.         put line 1 of field "Stats 2" into dadj
  498.       else put empty into dadj
  499.       if (character 1 of dadj)="+" then delete character 1 of dadj
  500.       put interp(wadj) into wstats
  501.       add dadj to item 4 of wstats
  502.       if item 1 of wstats is not 1 then put item 1 of wstats&"x" into wd
  503.       put item 2 of wstats&"d"&item 3 of wstats after wd
  504.       if item 4 of wstats>0 then put "+"&item 4 of wstats after wd
  505.       if item 4 of wstats<0 then put "-"&item 4 of wstats after wd
  506.       put wd into line i of field "weapon damage"
  507.     end if
  508.   end if
  509. end wpndmg
  510.  
  511. on wpndmg2 i
  512.   put line i of field "weapon" into wpn
  513.   if line i of field "weapon damage 2" is empty then
  514.     put empty into wadj
  515.     --general weapons
  516.     if "sword" is in wpn then put "1d12" into wadj
  517.     else if "flail" is in wpn then put "2d4" into wadj
  518.     else if "axe" is in wpn or "bow" is in wpn or "spear" is in wpn then
  519.       put "1d8" into wadj
  520.     else if "sling" is in wpn then
  521.       put "1d6+1" into wadj
  522.     else if "staff" is in wpn or "mace" is in wpn then
  523.       put "1d6" into wadj
  524.     else if "hammer" is in wpn then
  525.       put "1d4" into wadj
  526.     else if "club" is in wpn or "dagger" is in wpn then
  527.       put "1d3" into wadj
  528.     else if "dart" is in wpn or "knife" is in wpn then
  529.       put "1d2" into wadj
  530.     end if
  531.     --specific weapons
  532.     if wpn is "2-hand sword" then
  533.       put "3d6" into wadj
  534.     else if wpn is "scimitar" or wpn is "short sword" then
  535.       put "1d8" into wadj
  536.     else if wpn is "broad sword" or wpn is "morning star" then
  537.       put "1d6+1" into wadj
  538.     else if wpn is "khopesh" or wpn is "morning star" then
  539.       put "1d6" into wadj
  540.     else if wpn is "hand axe" or wpn is "throwing axe" or wpn is "sickle" then
  541.       put "1d4" into wadj
  542.     end if
  543.     if wadj is not empty then
  544.       if the short name of this background is "aHero" then
  545.         put line 1 of field "Stats 2" into dadj
  546.       else put empty into dadj
  547.       if (character 1 of dadj)="+" then delete character 1 of dadj
  548.       put interp(wadj) into wstats
  549.       add dadj to item 4 of wstats
  550.       if item 1 of wstats is not 1 then put item 1 of wstats&"x" into wd
  551.       put item 2 of wstats&"d"&item 3 of wstats after wd
  552.       if item 4 of wstats>0 then put "+"&item 4 of wstats after wd
  553.       if item 4 of wstats<0 then put "-"&item 4 of wstats after wd
  554.       put wd into line i of field "weapon damage 2"
  555.     end if
  556.   end if
  557. end wpndmg2
  558.  
  559.